package com.learn.springboot.controller.database.druid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangxing
 * @version 2020/8/3 22:42 Administrator
 */
@RestController
public class DruidController {
    private static final Logger LOGGER = LoggerFactory.getLogger(DruidController.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping("/druidData")
    public String druidData(){
        String sql = " select count(1) from ums_admin";
        Integer count = jdbcTemplate.queryForObject(sql, Integer.class);
        LOGGER.info("count={}",count);
        return "success";
    }
}
